package com.kancy;

import com.kancy.data.Person;
import com.kancy.netclass.InvokeHelper;

import javax.swing.*;

/**
 * @author huangchengkang
 * @date 2018-10-12 14:27
 */
public class Application {

    public static void main(String[] args) throws Exception {
        JOptionPane.showMessageDialog(null, "Hello Word!");

        for (int i = 0; i < 3; i++) {
            Object result = toJSONString(new Person());
            JOptionPane.showMessageDialog(null, "第"+(i+1) + "次调用结果："+ result);
        }
    }

    /**
     * com.alibaba.fastjson.JSON.toJSONString
     * @param person
     * @return
     */
    private static Object toJSONString(Object person) throws Exception {
        return InvokeHelper.newInstance().invoke("com.alibaba.fastjson.JSON", "toJSONString",
                new Class[]{Object.class} , new Object[]{person}, true);
    }
}
